<?php
/*
 * smarty
 * 
 */

class Template {

	private static $template = NULL;
	private static $instance = NULL;
	
	public static function get_template() {

		$smarty = new Smarty ();

		$smarty->template_dir 	= TPL_TEMPLATE_DIR;
		$smarty->compile_dir 	= TPL_COMPILED_DIR;
	//	$smarty->cache_dir 		= TPL_CACHE_DIR;
		$smarty->debugging 		= false;
		$smarty->caching 		= FALSE;
	//	$smarty->cache_lifetime = 120;
		$smarty->left_delimiter = '<{';
		$smarty->right_delimiter = '}>';
		
		self::$template = $smarty;

		return self::$template;
	}
	
	public static function display($info_array, $tpl_filename) {
		$smarty = self::get_template ();
		if (is_array ( $info_array )) {
			foreach ( $info_array as $key => $value ) {
				$smarty->assign ( $key, $value );
			}
		}
		
		$smarty->assign ( 'api_url', 	OPENAPI_URL );

		$smarty->display ( $tpl_filename );
	}

}
